export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))

export function debounceFn(fn: Function, delay: number) {
  let timer: NodeJS.Timeout
  return (...args: any) =>{
    clearTimeout(timer)
    timer = setTimeout(() => {
      fn.apply(null, args)
    }, delay)
  }
}
